package com.dw.dwdzcommerce.view.search;

import java.util.List;

import com.dw.dwdzcommerce.entity.*;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.dw.dwdzcommerce.R;


public class Lvadpter extends BaseAdapter {

	List<SearchHotGoods> list;
	Context context;

	public Lvadpter(Context context, List<SearchHotGoods> list) {
		this.list = list;
		this.context =context;

	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		SearchHotGoods text =   list.get(position);
		View view;
		ViewHolder viewHolder;
		if (convertView == null) {
			viewHolder = new ViewHolder();
			view = LayoutInflater.from(context).inflate(
					R.layout.item_lv_search, null);
			viewHolder.textview = (TextView) view
					.findViewById(R.id.msearch_tv_test);
			//viewHolder.textview.setText(text.getName());

		} else {
			view = convertView;
			viewHolder = (ViewHolder) view.getTag();

		}

		viewHolder.textview.setText(text.getName());
		return view;
	}

	class ViewHolder {
		TextView textview;

	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

}
